package com.example.graduatetest.activitys;

import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
import androidx.databinding.DataBindingUtil;
import androidx.lifecycle.ViewModelProviders;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;

import com.example.graduatetest.R;
import com.example.graduatetest.bean.Classes;
import com.example.graduatetest.databinding.ActivityScorePersonBinding;
import com.example.graduatetest.view.model.ScorePersonViewModel;
import com.example.graduatetest.view.model.SendCardViewModel;

public class ScorePersonActivity extends AppCompatActivity {
    private ActivityScorePersonBinding binding;
    private ScorePersonViewModel viewModel;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_score_person);

        //隐藏ActionBar
        if(getSupportActionBar() != null){
            ActionBar actionBar = getSupportActionBar();
            actionBar.hide();
        }
        binding = DataBindingUtil.setContentView(this,R.layout.activity_score_person);


        //接受Intent传来的数据
        Intent intent = getIntent();
        Classes ownClass = (Classes) intent.getSerializableExtra("classes");

        //LiveData
        viewModel = ViewModelProviders.of(this).get(ScorePersonViewModel.class);
        binding.setScorePersonViewModel(viewModel);
        binding.setLifecycleOwner(this);
        viewModel.init(this,binding,ownClass);
    }
}
